<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="imlgw,半岛铁盒,blog,Java博客,程序员,个人博客,java開發,程序員,個人博客,Java">
    <meta name="description" content="大悲无泪，大悟无言，大笑无声。">
    <meta name="author" content="Resolmi">
    
    <title>
        
            Java爬虫实战(一) ：爬取斗图社所有gif |
        
        Tadow
    </title>
    
<link rel="stylesheet" href="/css/style.css">

    <link rel="shortcut icon" href="https://static.imlgw.top/blog/20210731/BtJz541CcmJU.ico">
    <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/css/font-awesome.min.css">
    <script id="hexo-configurations">
    let KEEP = window.KEEP || {};
    KEEP.hexo_config = {"hostname":"imlgw.top","root":"/","language":"zh-CN","path":"search.json"};
    KEEP.theme_config = {"toc":{"enable":true,"number":true,"expand_all":true,"init_open":true},"style":{"primary_color":"#0066CC","avatar":"https://static.imlgw.top/blog/20210731/3C7hCSRR3lfq.png","favicon":"https://static.imlgw.top/blog/20210731/BtJz541CcmJU.ico","article_img_align":"left","left_side_width":"260px","content_max_width":"920px","hover":{"shadow":false,"scale":true},"first_screen":{"enable":true,"background_img":"/images/image.svg","description":"Keep It Simple & Stupid."},"scroll":{"progress_bar":{"enable":true},"percent":{"enable":true}}},"local_search":{"enable":true,"preload":false},"code_copy":{"enable":true,"style":"default"},"pjax":{"enable":true},"lazyload":{"enable":true},"version":"3.4.3"};
    KEEP.language_ago = {"second":"%s 秒前","minute":"%s 分钟前","hour":"%s 小时前","day":"%s 天前","week":"%s 周前","month":"%s 月前","year":"%s 年前"};
  </script>
<meta name="generator" content="Hexo 5.4.0"><link rel="stylesheet" href="/css/prism.css" type="text/css"></head>


<body>
<div class="progress-bar-container">
    
        <span class="scroll-progress-bar"></span>
    

    
        <span class="pjax-progress-bar"></span>
        <span class="pjax-progress-icon">
            <i class="fas fa-circle-notch fa-spin"></i>
        </span>
    
</div>


<main class="page-container">

    

    <div class="page-main-content">

        <div class="page-main-content-top">
            <header class="header-wrapper">

    <div class="header-content">
        <div class="left">
            
            <a class="logo-title" href="/">
                Tadow
            </a>
        </div>

        <div class="right">
            <div class="pc">
                <ul class="menu-list">
                    
                        <li class="menu-item">
                            <a class=""
                               href="/"
                            >
                                首页
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/archives"
                            >
                                归档
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/categories"
                            >
                                分类
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/sbe"
                            >
                                订阅
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/links"
                            >
                                友链
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/about"
                            >
                                关于
                            </a>
                        </li>
                    
                    
                        <li class="menu-item search search-popup-trigger">
                            <i class="fas fa-search"></i>
                        </li>
                    
                </ul>
            </div>
            <div class="mobile">
                
                    <div class="icon-item search search-popup-trigger"><i class="fas fa-search"></i></div>
                
                <div class="icon-item menu-bar">
                    <div class="menu-bar-middle"></div>
                </div>
            </div>
        </div>
    </div>

    <div class="header-drawer">
        <ul class="drawer-menu-list">
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/">首页</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/archives">归档</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/categories">分类</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/sbe">订阅</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/links">友链</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/about">关于</a>
                </li>
            
        </ul>
    </div>

    <div class="window-mask"></div>

</header>


        </div>

        <div class="page-main-content-middle">

            <div class="main-content">

                
                    <div class="fade-in-down-animation">
    <div class="article-content-container">

        <div class="article-title">
            <span class="title-hover-animation">Java爬虫实战(一) ：爬取斗图社所有gif</span>
        </div>

        
            <div class="article-header">
                <div class="avatar">
                    <img src="https://static.imlgw.top/blog/20210731/3C7hCSRR3lfq.png">
                </div>
                <div class="info">
                    <div class="author">
                        <span class="name">Resolmi</span>
                        
                            <span class="author-label">BOSS</span>
                        
                    </div>
                    <div class="meta-info">
                        <div class="article-meta-info">
    <span class="article-date article-meta-item">
        <i class="fas fa-edit"></i>&nbsp;2018-11-30 00:00:00
    </span>
    
        <span class="article-categories article-meta-item">
            <i class="fas fa-folder"></i>&nbsp;
            <ul>
                
                    <li>
                        <a href="/categories/%E7%88%AC%E8%99%AB/">爬虫</a>&nbsp;
                    </li>
                
            </ul>
        </span>
    
    
        <span class="article-tags article-meta-item">
            <i class="fas fa-tags"></i>&nbsp;
            <ul>
                
                    <li>
                        <a href="/tags/%E7%88%AC%E8%99%AB/">爬虫</a>&nbsp;
                    </li>
                
                    <li>
                        | <a href="/tags/Java/">Java</a>&nbsp;
                    </li>
                
                    <li>
                        | <a href="/tags/misc/">misc</a>&nbsp;
                    </li>
                
            </ul>
        </span>
    

    
    
        <span class="article-wordcount article-meta-item">
            <i class="fas fa-file-word"></i>&nbsp;<span>1.2k 字</span>
        </span>
    
    
        <span class="article-min2read article-meta-item">
            <i class="fas fa-clock"></i>&nbsp;<span>5 分钟</span>
        </span>
    
    
        <span class="article-pv article-meta-item">
            <i class="fas fa-eye"></i>&nbsp;<span id="busuanzi_value_page_pv"></span>
        </span>
    
</div>

                    </div>
                </div>
            </div>
        

        <div class="article-content markdown-body">
            <h2 id="Java爬虫实战-一-：爬取斗图社所有gif"><a href="#Java爬虫实战-一-：爬取斗图社所有gif" class="headerlink" title="Java爬虫实战(一) ：爬取斗图社所有gif"></a>Java爬虫实战(一) ：爬取斗图社所有gif</h2><p>最近开始玩爬虫 , 还是挺有意思的 , 虽然写爬虫一般都是用Python比较方便，但是也没有必要为了写爬虫再学一门语言 ,虽然也挺简单，但是还是对Java比较习惯，后面可能会学Python但是目前还是先用java写着玩玩。</p>
<p><strong>目标</strong><br><a class="link"   target="_blank" rel="noopener" href="https://doutushe.com/" >斗图社 <i class="fas fa-external-link-alt"></i></a>  上所有的图片。<br><img  
                     lazyload
                     src="/images/loading.svg"
                     data-src="https://imlgwpicture.oss-cn-qingdao.aliyuncs.com/blogImage/%408Q0%601FQB2A2E4D%5D9M8%40VW8.png"
                      alt="oss"
                ></p>
<p><strong>技术选择</strong><br>Jsoup，最开始看见这个我看成了Jsonp。。。我寻思着不是解决跨域的那个么?还能搞爬虫?这么牛掰的么😄<br>关于Jsoup网上也有很多文档 <a class="link"   target="_blank" rel="noopener" href="http://www.open-open.com/jsoup/" >参考资料<i class="fas fa-external-link-alt"></i></a><br>还有一些其他的技术比如 httpclient+Xpath 还有htmlunit 还有 selenium 等等，等以后学了后再来秀一秀 😁</p>
<hr>
<p>其实我写的第一个爬虫是copy的别人的博客上的，不过它爬取的是京东的，我爬的是淘宝的<br>我也只是想参考下他的结构，但是我感觉他的有些类没什么实际意义。。然后我就直接自己写了。<br>结构如下：</p>
<ul>
<li>boot ：爬虫的入口</li>
<li>dao  ：dao</li>
<li>handle ：封装的处理查询结果集的类（这里没用）</li>
<li>model ：爬取的数据的模型</li>
<li>parse  ： 解析html的类</li>
<li>util     ： Jsoup工具类和dao的工具类和DB模板类</li>
</ul>
<p>首先建立数据模型DoutuModel</p>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">DoutuModel</span> </span>&#123;</span><br><span class="line">	    <span class="keyword">private</span> Long id;</span><br><span class="line">	    <span class="keyword">private</span> String topic;</span><br><span class="line">	    <span class="keyword">private</span> String imgUrl;</span><br><span class="line">	    <span class="keyword">private</span> String title;</span><br><span class="line">	</span><br><span class="line">	    <span class="comment">//数据库id自增</span></span><br><span class="line">	    <span class="function"><span class="keyword">public</span> <span class="title">DoutuModel</span><span class="params">(String topic, String imgUrl, String title)</span> </span>&#123;</span><br><span class="line">	        <span class="keyword">this</span>.topic = topic;</span><br><span class="line">	        <span class="keyword">this</span>.imgUrl = imgUrl;</span><br><span class="line">	        <span class="keyword">this</span>.title = title;</span><br><span class="line">	    &#125;</span><br><span class="line">	</span><br><span class="line">	    <span class="function"><span class="keyword">public</span> String <span class="title">getTopic</span><span class="params">()</span> </span>&#123;</span><br><span class="line">	        <span class="keyword">return</span> topic;</span><br><span class="line">	    &#125;</span><br><span class="line">	</span><br><span class="line">	    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setTopic</span><span class="params">(String topic)</span> </span>&#123;</span><br><span class="line">	        <span class="keyword">this</span>.topic = topic;</span><br><span class="line">	    &#125;</span><br><span class="line">	</span><br><span class="line">	    <span class="function"><span class="keyword">public</span> String <span class="title">getTitle</span><span class="params">()</span> </span>&#123;</span><br><span class="line">	        <span class="keyword">return</span> title;</span><br><span class="line">	    &#125;</span><br><span class="line">	</span><br><span class="line">	    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setTitle</span><span class="params">(String title)</span> </span>&#123;</span><br><span class="line">	        <span class="keyword">this</span>.title = title;</span><br><span class="line">	    &#125;</span><br><span class="line">	</span><br><span class="line">	    <span class="function"><span class="keyword">public</span> String <span class="title">getImgUrl</span><span class="params">()</span> </span>&#123;</span><br><span class="line">	        <span class="keyword">return</span> imgUrl;</span><br><span class="line">	    &#125;</span><br><span class="line">	</span><br><span class="line">	    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setImgUrl</span><span class="params">(String imgUrl)</span> </span>&#123;</span><br><span class="line">	        <span class="keyword">this</span>.imgUrl = imgUrl;</span><br><span class="line">	    &#125;</span><br><span class="line">	</span><br><span class="line">	    <span class="function"><span class="keyword">public</span> Long <span class="title">getId</span><span class="params">()</span> </span>&#123;</span><br><span class="line">	        <span class="keyword">return</span> id;</span><br><span class="line">	    &#125;</span><br><span class="line">	</span><br><span class="line">	    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setId</span><span class="params">(Long id)</span> </span>&#123;</span><br><span class="line">	        <span class="keyword">this</span>.id = id;</span><br><span class="line">	    &#125;</span><br><span class="line">&#125;	</span><br></pre></td></tr></table></figure>

<p><strong>主要记录下parse类</strong></p>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> List&lt;DoutuModel&gt; <span class="title">getData2</span><span class="params">(String url)</span> <span class="keyword">throws</span> Exception </span>&#123;</span><br><span class="line">	        <span class="comment">//获取的数据，存放在集合中</span></span><br><span class="line">	        List&lt;DoutuModel&gt; data = <span class="keyword">new</span> ArrayList();</span><br><span class="line">	        <span class="comment">//采用Jsoup解析</span></span><br><span class="line">	        <span class="comment">//String url=&quot;https://doutushe.com/portal/article/index/id/5gK&quot;;</span></span><br><span class="line">	        String preurl = <span class="string">&quot;https://doutushe.com&quot;</span>;</span><br><span class="line">	        <span class="comment">//取到当前页的document</span></span><br><span class="line">	        <span class="comment">//取到内容页的所有图片</span></span><br><span class="line">	        <span class="keyword">int</span> page = <span class="number">1</span>;</span><br><span class="line">	        <span class="keyword">while</span> (<span class="keyword">true</span>) &#123;</span><br><span class="line">	            Document doc = JsoupUtils.getHtmlDocument(url);</span><br><span class="line">	            Elements imgList = doc.select(<span class="string">&quot;div[class=col-xs-12 col-sm-8 col-lg-9]&quot;</span>).select(<span class="string">&quot;img.lazy&quot;</span>);</span><br><span class="line">	            String topic = doc.select(<span class="string">&quot;blockquote&gt;p&quot;</span>).text();</span><br><span class="line">	            <span class="keyword">for</span> (Element imgelement : imgList) &#123;</span><br><span class="line">	                <span class="comment">//异步的坏处体现出来了,这个明显是懒加载,要找就找数据源,直接获取src获取不到</span></span><br><span class="line">	                <span class="comment">//String imgUrl= imgelement.attr(&quot;src&quot;);</span></span><br><span class="line">	                String imgUrl = imgelement.attr(<span class="string">&quot;data-original&quot;</span>);</span><br><span class="line">	                String title = imgelement.attr(<span class="string">&quot;title&quot;</span>);</span><br><span class="line">	                data.add(<span class="keyword">new</span> DoutuModel(topic, imgUrl, title));</span><br><span class="line">	                <span class="comment">//System.out.println(topic + &quot;:&quot; + imgUrl + &quot;:&quot; + title);</span></span><br><span class="line">	            &#125;</span><br><span class="line">	            Elements pageUrls = doc.select(<span class="string">&quot;ul.pager&quot;</span>).select(<span class="string">&quot;a&quot;</span>);</span><br><span class="line">	            <span class="comment">//爬一页休息1秒</span></span><br><span class="line">	            <span class="keyword">if</span> (page % <span class="number">10</span> == <span class="number">0</span>) &#123;</span><br><span class="line">	                Thread.sleep(<span class="number">1000</span>);</span><br><span class="line">	                System.out.println(<span class="string">&quot;第&quot;</span> + (page/<span class="number">10</span>) + <span class="string">&quot;页采集完 , 暂停-------&quot;</span>);</span><br><span class="line">	            &#125;</span><br><span class="line">	            <span class="comment">//最后一页也有两个按钮。。。看来要多观察页面</span></span><br><span class="line">	            <span class="comment">/*if (pageUrls.size() &lt; 2) &#123;</span></span><br><span class="line"><span class="comment">	                //说明到最后一页了</span></span><br><span class="line"><span class="comment">	                break;</span></span><br><span class="line"><span class="comment">	            &#125;*/</span></span><br><span class="line">	            url = preurl + pageUrls.get(<span class="number">1</span>).attr(<span class="string">&quot;href&quot;</span>);</span><br><span class="line">	            <span class="keyword">if</span> (!url.matches(preurl + <span class="string">&quot;/portal/article/index/id/[a-zA-Z0-9_]*&quot;</span>)) &#123;</span><br><span class="line">	                <span class="keyword">break</span>;</span><br><span class="line">	            &#125;</span><br><span class="line">	            page++;</span><br><span class="line">	        &#125;</span><br><span class="line">	        <span class="comment">//返回数据</span></span><br><span class="line">	        <span class="keyword">return</span> data;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>其实一开始写的一个版本是从主页面爬的先获取每一页的链接，再获取每一页的主题的链接，再获取每个主题下的图片链接，一个三重for循环，速度确实比较慢。。。</p>
<p>后来发现每一页都有下一页的链接。。。然后就可以直接从页面上爬，两个循环就可以了，但是一开始我判断边界的时候用的是在下面的链接的数量小于2但是一开始爬了好长时间结果报错了。。  然后我去看了下最后一页发现也有两个链接后面一个是全部的链接。。 。</p>
<p> <img  
                     lazyload
                     src="/images/loading.svg"
                     data-src="https://imlgwpicture.oss-cn-qingdao.aliyuncs.com/blogImage/AT5%7BUKZN%24M%5B59V%5B1OU0S%5B7N.png"
                      alt="oss"
                ><br>而且和上面的css是一样的但是和前面的每一页的链接的后缀不一样，所以就直接用正则表达式匹配url的后缀是否匹配<br>Regex ：<a class="link"   target="_blank" rel="noopener" href="https://doutushe.com/portal/article/index/id/[a-zA-Z0-9_]" >https://doutushe.com/portal/article/index/id/[a-zA-Z0-9_]<i class="fas fa-external-link-alt"></i></a>*  后面的就是直接匹配任意视频<br>而最后一页的全部链接是 ： <a class="link"   target="_blank" rel="noopener" href="https://doutushe.com/portal/index/index" >https://doutushe.com/portal/index/index<i class="fas fa-external-link-alt"></i></a> 所以就匹配不上直接break</p>
<p><strong>爬图片的小细节</strong> , 一开始没注意，他这个图片是懒加载的，也就是随着页面用js加载的， 直接src获取肯定获取不到的，因为jsoup是不支持异步的，用js操作的东西肯定爬不到。所以只能通过 data-orginal 获取。</p>
<p>github  <a class="link"   target="_blank" rel="noopener" href="https://github.com/imlgw/javaSpiders" >仓库地址<i class="fas fa-external-link-alt"></i></a></p>
<hr>
<p><strong>结果</strong><br><img  
                     lazyload
                     src="/images/loading.svg"
                     data-src="https://imlgwpicture.oss-cn-qingdao.aliyuncs.com/blogImage/X%28%7B%60H6YKH2LIW%24%25F2K4U53M.jpg"
                      alt="oss"
                ><br>4243张图片，后面可以自己写个脚本把图片全部下载到本地或者用迅雷之类的下载工具。</p>
<hr>
<p>后面会尝试下更多爬虫技术像 htmlunit这种支持异步的或者 selenium 这种直接操作浏览器的工具</p>

        </div>

        
            <div class="post-copyright-info">
                <div class="article-copyright-info-container">
    <ul>
        <li>本文标题：Java爬虫实战(一) ：爬取斗图社所有gif</li>
        <li>本文作者：Resolmi</li>
        <li>创建时间：2018-11-30 00:00:00</li>
        <li>
            本文链接：https://imlgw.top/2018/11/30/ada76fed/
        </li>
        <li>
            版权声明：本博客所有文章除特别声明外，均采用 <a class="license" target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">BY-NC-SA</a> 许可协议。转载请注明出处！
        </li>
    </ul>
</div>

            </div>
        

        
            <div class="article-nav">
                
                    <div class="article-prev">
                        <a class="prev"
                           rel="prev"
                           href="/2018/12/03/3b46123d/"
                        >
                            <span class="left arrow-icon flex-center">
                              <i class="fas fa-chevron-left"></i>
                            </span>
                            <span class="title flex-center">
                                <span class="post-nav-title-item">NodeJS模仿Express封装路由</span>
                                <span class="post-nav-item">上一篇</span>
                            </span>
                        </a>
                    </div>
                
                
                    <div class="article-next">
                        <a class="next"
                           rel="next"
                           href="/2018/11/26/2dc72c90/"
                        >
                            <span class="title flex-center">
                                <span class="post-nav-title-item">Spring-Security遇到的小问题</span>
                                <span class="post-nav-item">下一篇</span>
                            </span>
                            <span class="right arrow-icon flex-center">
                              <i class="fas fa-chevron-right"></i>
                            </span>
                        </a>
                    </div>
                
            </div>
        

        
            <div class="comment-container">
                <div class="comments-container">
    <div id="comment-anchor"></div>
    <div class="comment-area-title">
        <i class="fas fa-comments">&nbsp;评论</i>
    </div>
    

        
            <section class="disqus-comments">
<div id="disqus_thread">
  <noscript>Please enable JavaScript to view the <a target="_blank" rel="noopener" href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</section>

<script>
var disqus_shortname = 'imlgw';

var disqus_url = 'https://imlgw.top/2018/11/30/ada76fed/';

(function(){
  var dsq = document.createElement('script');
  dsq.type = 'text/javascript';
  dsq.async = true;
  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>

<script id="dsq-count-scr" src="//imlgw.disqus.com/count.js" async></script>
        
    
</div>

            </div>
        
    </div>
</div>


                
            </div>

        </div>

        <div class="page-main-content-bottom">
            <footer class="footer">
    <div class="info-container">
        <div class="copyright-info info-item">
            &copy;
            
              <span>2018</span>&nbsp;-&nbsp;
            
            2021&nbsp;<i class="fas fa-heart icon-animate"></i>&nbsp;<a href="/">Resolmi</a>
        </div>
        
            <script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
            <div class="website-count info-item">
                
                    <span id="busuanzi_container_site_uv">
                        访问人数&nbsp;<span id="busuanzi_value_site_uv"></span>&ensp;
                    </span>
                
                
                    <span id="busuanzi_container_site_pv">
                        总访问量&nbsp;<span id="busuanzi_value_site_pv"></span>
                    </span>
                
            </div>
        
        
            <div class="icp-info info-item"><a target="_blank" rel="nofollow" href="https://beian.miit.gov.cn">鄂ICP备18011208号</a></div>
        
    </div>
</footer>

        </div>
    </div>

    
        <div class="post-tools">
            <div class="post-tools-container">
    <ul class="tools-list">
        <!-- TOC aside toggle -->
        
            <li class="tools-item page-aside-toggle">
                <i class="fas fa-outdent"></i>
            </li>
        

        <!-- go comment -->
        
            <li class="go-comment">
                <i class="fas fa-comment"></i>
            </li>
        
    </ul>
</div>

        </div>
    

    <div class="right-bottom-side-tools">
        <div class="side-tools-container">
    <ul class="side-tools-list">
        <li class="tools-item tool-font-adjust-plus flex-center">
            <i class="fas fa-search-plus"></i>
        </li>

        <li class="tools-item tool-font-adjust-minus flex-center">
            <i class="fas fa-search-minus"></i>
        </li>

        <li class="tools-item tool-expand-width flex-center">
            <i class="fas fa-arrows-alt-h"></i>
        </li>

        <li class="tools-item tool-dark-light-toggle flex-center">
            <i class="fas fa-moon"></i>
        </li>

        <!-- rss -->
        

        

        <li class="tools-item tool-scroll-to-bottom flex-center">
            <i class="fas fa-arrow-down"></i>
        </li>
    </ul>

    <ul class="exposed-tools-list">
        <li class="tools-item tool-toggle-show flex-center">
            <i class="fas fa-cog fa-spin"></i>
        </li>
        
            <li class="tools-item tool-scroll-to-top flex-center">
                <i class="arrow-up fas fa-arrow-up"></i>
                <span class="percent"></span>
            </li>
        
    </ul>
</div>

    </div>

    
        <aside class="page-aside">
            <div class="post-toc-wrap">
    <div class="post-toc">
        <ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#Java%E7%88%AC%E8%99%AB%E5%AE%9E%E6%88%98-%E4%B8%80-%EF%BC%9A%E7%88%AC%E5%8F%96%E6%96%97%E5%9B%BE%E7%A4%BE%E6%89%80%E6%9C%89gif"><span class="nav-number">1.</span> <span class="nav-text">Java爬虫实战(一) ：爬取斗图社所有gif</span></a></li></ol>
    </div>
</div>
        </aside>
    

    <div class="image-viewer-container">
    <img src="">
</div>


    
        <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
          <span class="search-input-field-pre">
            <i class="fas fa-keyboard"></i>
          </span>
            <div class="search-input-container">
                <input autocomplete="off"
                       autocorrect="off"
                       autocapitalize="off"
                       placeholder="搜索..."
                       spellcheck="false"
                       type="search"
                       class="search-input"
                >
            </div>
            <span class="popup-btn-close">
                <i class="fas fa-times"></i>
            </span>
        </div>
        <div id="search-result">
            <div id="no-result">
                <i class="fas fa-spinner fa-pulse fa-5x fa-fw"></i>
            </div>
        </div>
    </div>
</div>

    

</main>



<script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/utils.js"></script><script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/main.js"></script><script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/header-shrink.js"></script><script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/back2top.js"></script><script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/dark-light-toggle.js"></script>


    <script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/local-search.js"></script>



    <script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/code-copy.js"></script>



    <script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/lazyload.js"></script>


<div class="post-scripts pjax">
    
        <script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/left-side-toggle.js"></script><script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/libs/anime.min.js"></script><script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/toc.js"></script>
    
</div>


    <script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@3.4.3/source/js/libs/pjax.min.js"></script>
<script>
    window.addEventListener('DOMContentLoaded', () => {
        window.pjax = new Pjax({
            selectors: [
                'head title',
                '.page-container',
                '.pjax'
            ],
            history: true,
            debug: false,
            cacheBust: false,
            timeout: 0,
            analytics: false,
            currentUrlFullReload: false,
            scrollRestoration: false,
            // scrollTo: true,
        });

        document.addEventListener('pjax:send', () => {
            KEEP.utils.pjaxProgressBarStart();
        });

        document.addEventListener('pjax:complete', () => {
            KEEP.utils.pjaxProgressBarEnd();
            window.pjax.executeScripts(document.querySelectorAll('script[data-pjax], .pjax script'));
            KEEP.refresh();
        });
    });
</script>



<script src="https://cdn.jsdelivr.net/npm/live2d-widget@3.x/lib/L2Dwidget.min.js"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"https://cdn.jsdelivr.net/npm/live2d-widget-model-hijiki@1.0.5/assets/hijiki.model.json"},"display":{"superSample":2,"width":160,"height":320,"position":"right","hOffset":0,"vOffset":-70},"mobile":{"show":false,"scale":0.2},"log":false});</script></body>
</html>
